home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / Timing.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  4KB  |  131 lines

  1. /*
  2.      File:        Timing.h
  3.  
  4.      Contains:    Kernel Timing Interfaces.
  5.  
  6.      Version:    Technology:    System 8
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __TIMING__
  19. #define __TIMING__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. #if PRAGMA_IMPORT_SUPPORTED
  30. #pragma import on
  31. #endif
  32.  
  33. #if PRAGMA_ALIGN_SUPPORTED
  34. #pragma options align=power
  35. /* the following contents can only be used by compilers that support PowerPC struct alignment */
  36.  
  37. #if FOR_SYSTEM8_PREEMPTIVE
  38.  
  39. enum {
  40.     kDurationMicrosecond        = -1L,                            /* Microseconds are negative */
  41.     kDurationMillisecond        = 1L,                            /* Milliseconds are positive*/
  42.     kDurationSecond                = 1000L,                        /* 1000 * durationMillisecond*/
  43.     kDurationMinute                = 60000L,                        /* 60 * durationSecond,*/
  44.     kDurationHour                = 3600000L,                        /* 60 * durationMinute,*/
  45.     kDurationDay                = 86400000L,                    /* 24 * durationHour,*/
  46.     kDurationNoWait                = 0L,                            /* don't block*/
  47.     kDurationForever            = 0x7FFFFFFF                    /* no time limit*/
  48. };
  49.  
  50. #if OLDROUTINENAMES
  51.  
  52. enum {
  53.     durationMicrosecond            = kDurationMicrosecond,
  54.     durationMillisecond            = kDurationMillisecond,
  55.     durationSecond                = kDurationSecond,
  56.     durationMinute                = kDurationMinute,
  57.     durationHour                = kDurationHour,
  58.     durationDay                    = kDurationDay,
  59.     durationNoWait                = kDurationNoWait,
  60.     durationForever                = kDurationForever
  61. };
  62.  
  63. #endif
  64. typedef UInt64 Nanoseconds;
  65. typedef UInt32 Ticks;
  66. /*
  67.     Time Information Routines
  68. */
  69. extern AbsoluteTime UpTime(void );
  70.  
  71. extern AbsoluteTime TaskCPUTime(void );
  72.  
  73. extern void GetTimeBaseInfo(UInt32 *theMinAbsoluteTimeDelta, UInt32 *theAbsoluteTimeToNanosecondNumerator, UInt32 *theAbsoluteTimeToNanosecondDenominator, UInt32 *theProcessorToAbsoluteTimeNumerator, UInt32 *theProcessorToAbsoluteTimeDenominator);
  74.  
  75. /*
  76.     Timing Conversion Routines
  77. */
  78. extern Nanoseconds AbsoluteToNanoseconds(AbsoluteTime theAbsoluteTime);
  79.  
  80. extern Duration AbsoluteToDuration(AbsoluteTime theAbsoluteTime);
  81.  
  82. extern AbsoluteTime NanosecondsToAbsolute(Nanoseconds theNanoseconds);
  83.  
  84. extern AbsoluteTime DurationToAbsolute(Duration theDuration);
  85.  
  86. extern Nanoseconds DurationToNanoseconds(Duration theDuration);
  87.  
  88. extern Duration NanosecondsToDuration(Nanoseconds theNanoseconds);
  89.  
  90. extern Ticks AbsoluteToTicks(AbsoluteTime theAbsoluteTime);
  91.  
  92. extern AbsoluteTime TicksToAbsolute(Ticks theTicks);
  93.  
  94. /*
  95.     AbsoluteTime Adjustment Routines
  96. */
  97. extern AbsoluteTime AddAbsoluteToAbsolute(AbsoluteTime theAbsoluteTime1, AbsoluteTime theAbsoluteTime2);
  98.  
  99. extern AbsoluteTime SubAbsoluteFromAbsolute(AbsoluteTime theLeftAbsoluteTime, AbsoluteTime theRightAbsoluteTime);
  100.  
  101. extern AbsoluteTime AddNanosecondsToAbsolute(Nanoseconds theNanoseconds, AbsoluteTime theAbsoluteTime);
  102.  
  103. extern AbsoluteTime AddDurationToAbsolute(Duration theDuration, AbsoluteTime theAbsoluteTime);
  104.  
  105. extern AbsoluteTime SubNanosecondsFromAbsolute(Nanoseconds theNanoseconds, AbsoluteTime theAbsoluteTime);
  106.  
  107. extern AbsoluteTime SubDurationFromAbsolute(Duration theDuration, AbsoluteTime theAbsoluteTime);
  108.  
  109. /*
  110.     Timing Delta Routines
  111. */
  112. extern Nanoseconds AbsoluteDeltaToNanoseconds(AbsoluteTime theLeftAbsoluteTime, AbsoluteTime theRightAbsoluteTime);
  113.  
  114. extern Duration AbsoluteDeltaToDuration(AbsoluteTime theLeftAbsoluteTime, AbsoluteTime theRightAbsoluteTime);
  115.  
  116. #endif
  117.  
  118. #pragma options align=reset
  119. #endif /* PRAGMA_ALIGN_SUPPORTED */
  120.  
  121. #if PRAGMA_IMPORT_SUPPORTED
  122. #pragma import off
  123. #endif
  124.  
  125. #ifdef __cplusplus
  126. }
  127. #endif
  128.  
  129. #endif /* __TIMING__ */
  130.  
  131.